{
    title:  'Sandboxing',
    crumbs: [
        { "User's Guide": '../index.html' },
        { 'Configuration': '../configuration.html' },
    ],
}
            <h1>Sandbox Directives</h1>
            <p>Appweb supports directives that limit its use of system resources such as memory and threads. This
            technique is know as "sandboxing" because it creates a limited or safer area in which Appweb
            executes.</p>
            
            <a id="exitTimeout"></a>
            <h2>ExitTimeout</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Timeout to wait when exiting or restarting</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>ExitTimeout period</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>ExitTimeout 30secs</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>This directive defines the maximum time to wait for existing requests to complete
                            before exiting or restarting Appweb. </p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitBuffer"></a>
            <h2>LimitBuffer</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Defines the pipeline stage buffer size</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitBuffer size</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitBuffer 8192</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>This directive defines the maximum buffer size in bytes for each stage in the request
                            pipeline. This directive places a limit on the amount of memory consumed by pipeline stages.
                            <p>NOTE: this does not imply a maximum response size (See LimitResponseBody for that
                            functionality). It merely limits the memory consumed when trying to buffer the response data. 
                            Appweb handlers will flush the buffers and use HTTP/1.1 chunked output if the amount of 
                            response data exceeds the output buffer size.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitCache"></a>
            <h2>LimitCache</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Maximum size of response data and session state</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitCache size</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitCache 8192</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>This directive defines the maximum size of the Appweb data cache. This cache store is used
                            for caching responses and for the session state date for ESP applications. If the maximum size
                            is exceeded, Appweb will prune the oldest data in the cache to make room for newer items.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitCacheItem"></a>
            <h2>LimitCacheItem</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Maximum size of a single item in the cache</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitCacheItem size</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitCacheItem 512K</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>This directive defines the maximum size of a single item in the Appweb data cache. 
                            This cache store is used for caching responses and for the session state date for ESP
                            applications. If the maximum size is exceeded, Appweb will not store the item in the cache.
                            The request will continue, but not be served from the cache.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitChunk"></a>
            <h2>LimitChunk</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Defines the maximum chunk size</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitChunk size</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitChunk 8192</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>This directive defines the maximum chunk size when using Transfer Chunk Encoding.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitClients"></a>
            <h2>LimitClients</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Sets the maximum number of simultaneous client systems</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitClients count</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitClients 10</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitClients directive defines the maximum number of simultaneous 
                            client systems that can connect to the server. Connections in excess of this count will 
                            be rejected. A limit of '0' means unlimited.</p>
                            <p>This directive counts the number of unique client systems. A system with many users all using
                            the same IP address will be counted as one client.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitConnections"></a>
            <h2>LimitConnections</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Sets the maximum number of simultaneous client endpoint connections</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitConnections count</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitConnections 50</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitConnections directive defines the maximum number of simultaneous 
                            client connections to the server. Connections in excess of this count will 
                            be rejected. A limit of '0' means unlimited.</p>
                            <p>This directive counts the number of client socket connections. A single browser may open
                            many separate connections (typically up to 6). </p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitFiles"></a>
            <h2>LimitFiles</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Sets the maximum number of open files/sockets that Appweb can open.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitFiles count</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitFiles 1024</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitFiles directive defines the maximum number of files/sockets that Appweb can
                            open on a Unix system. The files limit must be set sufficiently high to support the peak
                            load anticipated for Appweb. Each request will always consume one file descriptor for the
                            network socket. CGI requests will consume an additional three file descriptors to communicate
                            with the CGI process.</p>
                            <p>The default limit for Appweb is defined by the system ulimit.
                            A limit of '0' means set the limit to the maximum permitted by the operating system.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitKeepAlive"></a>
            <h2>LimitKeepAlive</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Define the maximum number of requests for a connection.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitKeepAlive number</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default Server, Virtual Host, Route</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitKeepAlive 50</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>This directive defines the maximum number of requests that may be serviced using a
                            single TCP/IP connection.</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="security">Security</td>
                        <td>
                            <p>Limiting the number to a reasonable maximum can help reduce the impact of some denial of
                            service attacks.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitMemory"></a>
            <h2>LimitMemory</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Sets the maximum heap memory that Appweb can allocate.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitMemory size</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitSize 10MB</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitMemory directive defines the maximum amount of memory that Appweb can use.
                            On Linux and MacOSX, where a fast memory size API exists, this is the amount of memory currently
                            used by the application. On other platforms, it is the amount of Appweb heap memory and 
                            does not include thread stack, code allocations, or memory allocated by means other than
                            the MPR memory allocation primitives.
                            If the memory limit is exceeded, Appweb will invoke the policy specified by the
                            MemoryPolicy directive.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitProcesses"></a>
            <h2>LimitProcesses</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Sets the maximum number of processes Appweb will spawn for CGI.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitProcesses count</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitProcesses 1000000</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitProcesses directive defines the maximum number of processes that Appweb will
                            spawn to serve CGI processes. If this maximum is exceeded, Appweb will deny the request.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitRequestsPerClient"></a>
            <h2>LimitRequestsPerClient</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Sets the maximum number of simultaneous HTTP requests for a single client IP address</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitRequestsPerClient count</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost, Route</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitRequestsPerClient 20</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitRequestsPerClient directive defines the maximum number of simultaneous 
                            client HTTP requests that are permitted per single client IP address. Requests in excess of this
                            count will be rejected. A limit of '0' means unlimited.</p>
                            <p>NOTE: that many browsers can and will initiate multiple requests when requesting a
                            page. Some browsers will initiate up to six requests at a time for a single tab.</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="security">Security</td>
                        <td>
                            <p>To mitigate denial of service attacks, this limit should be set as low as possible.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitRequestBody"></a>
            <h2>LimitRequestBody</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Sets the maximum size of the request body from the client.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitRequestBody limit</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitRequestBody 65536</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitRequestBody directive defines a maximum size for the request body. For embedded
                            applications, it is useful to limit the request body to the expected maximum. This ensures
                            that rogue or malicious requests will not cause the server to allocate unwanted memory to
                            servicing the request.</p>
                            <p>The limit is an integer between zero and 2147483647 (2GB), where zero means unlimited.
                            If a request is received that is larger than the limit, it will be rejected and the client
                            will receive an error. The default limit is 64 MB.</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="security">Security</td>
                        <td>
                            <p>This directive can be quite useful in certain denial-of-service attacks where the
                            attacker sends large documents of a certain type.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitRequestForm"></a>
            <h2>LimitRequestForm</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Sets the maximum size of the request form from the client.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitRequestForm limit</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitRequestForm 65536</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitRequestForm directive defines a maximum size for the request form data. 
                            Form data is encoded with a Content-Type of "application/x-www-form-urlencoded". Form data
                            is fully buffered before doing Route matching and constructing the pipeline. Whereas, 
                            non-form data is streamed to the handler and not buffered.</p>
                            <p>For embedded
                            applications, it is useful to limit the request body to the expected maximum. This ensures
                            that rogue or malicious requests will not cause the server to allocate unwanted memory to
                            servicing the request.</p>
                            <p>The limit is an integer between zero and 2147483647 (2GB), where zero means unlimited.
                            If a request is received that is larger than the limit, it will be rejected and the client
                            will receive an error. The default limit is 64 MB.</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="security">Security</td>
                        <td>
                            <p>This directive can be quite useful in certain denial-of-service attacks where the
                            attacker sends large documents of a certain type.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            
            <a id="limitRequestHeader"></a>
            <h2>LimitRequestHeader</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Maximum size of the request headers from the client</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitRequestHeader limit</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitRequestHeader 65536</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitRequestHeader directive defines the maximum size of the request header from
                            the client. For embedded applications, it is useful to limit the size of the header to the
                            expected maximum. This ensures that rogue or malicious requests will not cause the server
                            to allocate unwanted memory to servicing the request. Typically, HTTP requests will not
                            have more than 4K of header data.</p>
                            <p>The limit is an integer between zero and 1 MB, where zero means unlimited. If a request
                            is received that has a header larger than the limit, it will be rejected and the client
                            will receive an error. The default limit is 8 K.</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="security">Security</td>
                        <td>
                            <p>This directive can be quite useful in certain denial-of-service attacks where the
                            attacker sends requests with large bogus headers.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitRequestHeaderLines"></a>
            <h2>LimitRequestHeaderLines</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Maximum number of header lines in the request body from the client.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitRequestHeaderLines limit</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitRequestHeaderLines 64</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitRequestHeaderLines directive defines a maximum number of header lines that may be in
                            a request from a client. For embedded applications, it is useful to limit the number of
                            header lines to the expected maximum. This ensures that rogue or malicious requests will
                            not cause the server to allocate unwanted memory to servicing the request. Typically, HTTP
                            requests will not have more than 15-20 header lines.</p>
                            <p>The limit is an integer between zero and 4096, where zero means unlimited. If a request
                            is received that has more header lines than the limit, it will be rejected and the client
                            will receive an error. The default limit is 40.</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="security">Security</td>
                        <td>
                            <p>This directive can be quite useful in certain denial-of-service attacks where the
                            attacker sends requests with many spurious header lines.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            
            <a id="limitResponseBody"></a>
            <h2>LimitResponseBody</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Set the maximum size of the response body buffered by a dynamic Appweb handler.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitResponseBody number</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost, Route</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitResponseBody 65536</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitResponseBody directive defines the maximum size for response body data.
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitSessions"></a>
            <h2>LimitSessions</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Sets the maximum number of simultaneous client sessions</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitSessions count</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost, Route</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitSessions 40</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitSessions directive defines the maximum number of simultaneous 
                            client sessions that utilize server-side session state storage. Requests in excess of this 
                            count will be rejected. A limit of '0' means unlimited.</p>
                            <p>This directive limits the number of session states, whereas the LimitClients directive
                            limits the number of connected client systems.</p>
                            <p>NOTE: that many browsers can and will initiate multiple requests when requesting a
                            page. These will share the same session state storage. Some browsers will initiate up to six
                            requests at a time for a single tab.</p> 
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitUri"></a>
            <h2>LimitUri</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Maximum size of a URL in a request from a client.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitUri limit</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitUri 4096</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitUri directive defines the maximum size of a URL in Appweb. In embedded
                            applications, it is useful to limit the number of header lines to the expected maximum.
                            This ensures that rogue or malicious requests will not cause the server to allocate
                            unwanted memory to servicing the request.</p>
                            <p>The limit is an integer between zero and 256 K where zero means unlimited. If a request
                            is received that has a URL larger than the limit, it will be rejected and the client will
                            receive an error. The default limit is 4 K.</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="security">Security</td>
                        <td>
                            <p>This directive can be quite useful in certain denial-of-service attacks where the
                            attacker sends requests with bogus URLs.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            
            <a id="limitUpload"></a>
            <h2>LimitUpload</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Maximum size of a URL in a request from a client.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitUpload size</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server, VirtualHost</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitUpload 20MB</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitUpload directive defines the maximum size of an uploaded file. In embedded
                            applications, it is useful to limit the maximum file upload size to ensure
                            that rogue or malicious requests will not cause the server to allocate unwanted space
                            for uploads.</p>
                            <p>If set to zero, there is no limit. If a file larger than the limit is uploaded,
                            Appweb will reject the request and the client will receive an error. 
                            The default value is unlimited.</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="security">Security</td>
                        <td>
                            <p>This directive can be quite useful in certain denial-of-service attacks where the
                            attacker sends requests with bogus URLs.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            
            <a id="memoryPolicy"></a>
            <h2>Memory Policy</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Defines the policy for memory depletion situations.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>MemoryPolicy continue|restart</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default server</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>MemoryPolicy restart</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>Appweb manages memory proactively and ensures reliable operation by preventing memory 
                            allocation errors before they occur. It does this by defining a memory limit and applying 
                            a memory policy for how to react when memory is depleted.</p>
                            <p>The MemoryPolicy directive defines how Appweb will respond to low memory conditions.
                            While the LimitMemory directive defines a maximum amount of memory that Appweb is permitted to
                            use, the MemoryPolicy directive defines how Appweb will respond when the limit is
                            approached and exceeded.</p>
                            <p>If memory utilization exceeds the maximum memory limit, Appweb
                            will invoke the memory depletion policy defined by this directive.
                            Appweb also institutes a memory redline that is 85% of the memory limit. When memory
                            utilization exceeds the redline value, Appweb will issue a warning to the error log and 
                            attempt to free non-essential memory such as old session data and request caching. </p>
                            <p>If the memory policy is set to <em>continue</em>, Appweb will prune all non-essential memory,
                            but will continue to run. i.e. the limit becomes a soft limit and can be exceeded. If the policy
                            is set to <em>restart</em>, then Appweb will do a graceful restart if the maximum is exceeded. 
                            A graceful restart will allow existing requests to complete up to the timeout specified by
                            the ExitTimeout directive. Appweb relies on the <em>appman</em> manager application to restart 
                            appweb in this case.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            
            <a id="minWorkers"></a>
            <h2>MinWorkers</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Number of worker threads to pre-allocate in the Appweb worker pool</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>MinWorkers number</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default Server</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>MinWorkers 100</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The MinWorkers directive will pre-allocate the specified number of worker threads on startup
                            and then ensure that the worker pool always has at least this minimum number of workers.</p>
                            <p>Appweb will automatically adjust the number of workers between the minimum specified
                            by this directive and the maximum specified by the WorkerLimit directive or via the Appweb
                            command line. Every ten minutes, Appweb will prune workers that have been idle for five
                            minutes to reduce resource consumption.</p>
                            <p>Appweb 4 has two non-worker threads: one for the master event loop and one for the
                            garbage collector. So the total number of Appweb threads will be two plus the number of
                            active workers.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            
            <a id="threadStack"></a>
            <h2>ThreadStack</h2><br />
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Define the size of the stack to allocate for each thread</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>ThreadStack limit</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default Server</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>ThreadStack 64K</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The ThreadStack directive defines the size of the thread stack to allocate for each
                            thread. The limit is an integer between zero and an operating system defined maximum&nbsp;
                            where zero means use the system default. The default limit is zero which implies the system
                            default.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <a id="limitWebSocketsMessage"></a>
            <h2>LimitWebSocketsMessage</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>pool.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitWebSocketsMessage number</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default Server, Virtual Host, Route</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitWebSocketsMessage 64K</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitWebSocketsMessage directive defines the maximum size of a
                                Web Sockets message.</p>
                        </td>
                    </tr>
                </tbody>
            </table>            
            <a id="limitWebSocketsPacket"></a>
            <h2>WorkerLimit</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Maximum size of a packet containing a portion of a Web Sockets message.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitWebSocketsPacket size</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default Server, Virtual Host, Route</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitWebSocketsPacket 8K</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>This defines the maximum packet size for a portion of a Web Sockets message.</p>
                        </td>
                    </tr>
                </tbody>
            </table>            
            <a id="limitWebSocketsFrame"></a>
            <h2>LimitWebSocketsFrame</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Maximum size of a Web Sockets message frame.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitWebSocketsFrame size</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default Server, Virtual Server, Route</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitWebSocketsFrame 4K</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>This specifies the maximum frame size used for Web Sockets messages when
                                sent over the wire.</p>
                        </td>
                    </tr>
                </tbody>
            </table>            
            <a id="limitWorkers"></a>
            <h2>LimitWorkers</h2>
            <table class="directive" title="directive">
                <tbody>
                    <tr>
                        <td class="pivot">Description</td>
                        <td>Maximum number of worker threads to allocate for the Appweb worker pool.</td>
                    </tr>
                    <tr>
                        <td class="pivot">Synopsis</td>
                        <td>LimitWorkers number</td>
                    </tr>
                    <tr>
                        <td class="pivot">Context</td>
                        <td>Default Server</td>
                    </tr>
                    <tr>
                        <td class="pivot">Example</td>
                        <td>LimitWorkers 8</td>
                    </tr>
                    <tr>
                        <td class="pivot">Notes</td>
                        <td>
                            <p>The LimitWorkers directive defines a maximum number of threads for the Appweb thread
                            pool. When running in multithreaded mode, Appweb will use a pool thread to service each
                            request and then will return the thread to the pool. This results in a highly responsive
                            and scalable architecture with excellent throughput characteristics. Each thread requires a
                            thread stack and thus consumes memory. By limiting the number of threads, memory can be
                            conserved.</p>
                            <p>If the maximum number of threads is also specified via the <a href=
                            "../../start/starting.html">Appweb command line</a>, the command line value will take
                            precedence.</p>
                            <p>Appweb will automatically adjust the number of pool threads between the minimum specified
                            by the MinWorkers directive and the maximum specified by this directive. Appweb will
                            prune idle threads to reduce resource consumption as required.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
